<template lang="html">
  <div :class=" isClient ? 'buy_vip top' : 'buy_vip'">
    <van-swipe :autoplay="3000" indicator-color="white" :show-indicators="false" :vertical="true" :height="60" :touchable="false">
      <van-swipe-item v-for="(item, key) in swiper_list" v-bind:key="key">
        <div class="swiper_item">
          <span class="buy_vip_user_img"><img v-bind:src="item.head_portrait" alt=""> </span>
          {{item.user_nickname}}刚刚加入了美家美货会员</div>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import Tool from '@/utils/tool'
export default {
  data () {
    return {
      active: 1,
      isClient: false,
      swiper_list: [
        { id: 1, name: '我是xxx' },
        { id: 1, name: '我是' }
      ]
    }
  },
  created () {
    this.getBuyVip()
    if (Tool.isClient()) {
      this.isClient = true
    }
  },
  methods: {
    getBuyVip () {
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'user_buy_vip', method: 'get' }).then((resp) => { // 请求成功
          if (resp.return_code === '0000') {
            this.swiper_list = resp.data.list
          } else {

          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>
